<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
 <div>
	  <input type="button" value="全选"/>
	  <input type="button" value="全不选"/>
	  <input type="button" value="反选"/>
 </div>

 <div>
  <p><input type="checkbox"/>旅游</p>
  <p><input type="checkbox"/>看书</p>
  <p><input type="checkbox"/>打游戏</p>
  <p><input type="checkbox"/>跑步</p>
  <p><input type="checkbox"/>看电影</p>
 </div>
 </body>
</html>
<script>
	var oInOne = document.getElementsByTagName('div')[0].getElementsByTagName('input')[0];
	var oInTwo = document.getElementsByTagName('div')[0].getElementsByTagName('input')[1];
	var oInThree = document.getElementsByTagName('div')[0].getElementsByTagName('input')[2];

	var aInput = document.getElementsByTagName('div')[1].getElementsByTagName('input');
	console.log(oInOne);
	console.log(oInTwo);
	console.log(oInThree);
	console.log(aInput);
	var d=0;
	var e='ckecked';
	
	oInOne.onclick = function(){
		for (var a=0;a<aInput.length ;a++ )
		{
			aInput[a].checked = 'e';
			//d = oInput[a].checked;
			//console.log(d);
		}	
	}
	oInTwo.onclick = function(){
		for (var b=0;b<aInput.length ;b++ )
		{
			aInput[b].checked = '';
		}	
	}
	oInThree.onclick = function(){
		for (var c=0;c<aInput.length ;c++ )
		{
			if (aInput[c].checked == true)
			{
				aInput[c].checked = false;
			}else{
				aInput[c].checked = true;
			};
		}	
	}
</script>
